function [M, A, S]  = getarch(P, F)
% [M, A, S] = GETARCH(P, F)

if nargin < 2
  F = gcf;
end

rect = getrect(F);
rect = rect(1:2);

mindist = inf;
for i = 1:size(P, 1)
  if norm(cell2mat(P(i, 1:2)) - rect) < mindist
    mindist = norm(cell2mat(P(i, 1:2)) - rect);
    arch = [i];
  elseif norm(cell2mat(P(i, 1:2)) - rect) == mindist
    arch = [arch i];
  end
end

fprintf('selected (%f, %f) with distance %f\n', P{arch(1), 1:2}, mindist)
for i = arch
  fprintf('%d %s\n', i, P{i, end})
end
